package com.ynny.controller;

import com.ynny.service.studentService;
import com.ynny.entity.student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/student")
public class studentController {

    @Autowired
     studentService studentService;
    @RequestMapping("/register")
    public String register(@RequestBody student student){
       if (student.getUsername().equals("") || student.getPassword().equals("")){
           return "用户名或密码不能为空";

       }
       int i = studentService.register(student);
       if (i == 1){
           return "注册成功";
       }else {
           return "注册失败";
       }


    }

}
